# -*-coding:utf-8 -*-
from django import forms

class AddMenuCategoryForm(forms.Form):
    name = forms.CharField(label='类别名', max_length=30)
    
class EditMenuCategoryForm(forms.Form):
    old_category = forms.TypedChoiceField(label='旧类别名',choices=())
    new_category = forms.CharField(label='新类别名', max_length=30)
    
    def set_choices(self, value):
        self.fields['old_category']._set_choices(value)
         
class AddMenuItemForm(forms.Form):
    category = forms.ChoiceField(label='类别',)
    name = forms.CharField(label='菜品名', max_length=30)
    price = forms.IntegerField(label='价格',)
    description = forms.CharField(label='描述', max_length=30,required=False)
    
    def set_choices(self, value):
        self.fields['category']._set_choices(value)
    
class EditMenuItemForm(forms.Form):
    category = forms.ChoiceField(label='类别',)
    old = forms.ChoiceField(label='原菜品名',)
    new = forms.CharField(label='新菜品名', max_length=30)
    price = forms.IntegerField(label='价格',)
    description = forms.CharField(label='描述', max_length=30,required=False)   
    
    def set_choices(self, value):
        self.fields['category']._set_choices(value)